Skip to content

fix(catalog-sync): resolve target from --config, not OPENCODE_CONFIG_PATH (#4588) - #4591

Merged
dezren39 merged 2 commits into
mainfrom
queue/6473-4588-catalog-sync-config
Nov 2, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/6473-4588-catalog-sync-config

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #4588.

Since the #4544 split, OPENCODE_CONFIG_PATH names the runtime overlay and is exported into every user session — but provider-catalog-sync resolved its target as OPENCODE_CONFIG_PATH || --config, so it diffed (and with --apply would have written into) the overlay instead of the tracked configured default, and the env var beat an explicit --config flag.

  • New exported resolveConfigPath: explicit --config → OPENCODE_CATALOG_SYNC_CONFIG → <repo>/.opencode/opencode.jsonc. OPENCODE_CONFIG_PATH is never consulted for the target (the overlay is still read via --runtime-config for the merged effective config).
  • Header comment documents the resolution and why.
  • Regression tests in bin/provider-catalog-sync.test.mjs: unit coverage of the full precedence (flag > catalog env > default, OPENCODE_CONFIG_PATH ignored in every leg) plus an end-to-end CLI run with OPENCODE_CONFIG_PATH pointing at an overlay fixture, asserting the report targets the tracked file and finds the validated addition (exit 3).

Tests: node --test bin/provider-catalog-sync.test.mjs — 30/30 pass (28 existing + 2 new).

Queue: task 6473 (triage task 6470 confirmed the defect at main 73c0ec7).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 21:39
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9d8c0ff7-7c15-43cc-af0f-dd74825719ce
Commits

Reviewing files that changed from the base of the PR and between 26ce876 and 0e4afc8.

Files selected for processing: 2
  • bin/provider-catalog-sync.mjs
  • bin/provider-catalog-sync.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T21:47:49.306267Z 0e4afc8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab2991c64d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +372 to +375
const r = runCli(
['--config', configPath, '--runtime-config', overlayPath, '--models-dev', modelsDev, '--source-dir', sourceDir, '--json'],
{ OPENCODE_CONFIG_PATH: overlayPath },
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the environment override in the CLI regression test

The runCli helper deletes clean.OPENCODE_CONFIG_PATH after merging the supplied environment overrides, so this test never launches the CLI with the overlay variable set. Consequently, it would still pass with the original buggy config-resolution expression in main, leaving the end-to-end regression unprotected despite the helper-level unit coverage. Remove inherited values before applying explicit overrides, or spawn the CLI directly here so the intended environment reaches the child process.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0e4afc8 — you were right, thank you. runCli spread the caller's env and then unconditionally deleted OPENCODE_CONFIG_PATH, so the CLI test never actually launched with the variable set and would have passed against the buggy code.

runCli now scrubs the ambient variable only when the test does not pass it explicitly. Verified the regression bites, running the same fixtures (tracked default with commandcode/acme-1, source snapshot adding acme-2, overlay with openai/g-1) with OPENCODE_CONFIG_PATH=<overlay> set:

  • pre-fix script (base 26ce876): exit 0, report "config": ".../overlay.jsonc" — the bug
  • fixed script: exit 3, report "config": ".../tracked.jsonc" — validated addition found

Full suite: node --test bin/provider-catalog-sync.test.mjs — 30/30 pass.

@codex review

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 0e4afc875f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant